#include <stdio.h>
#include <stdlib.h>
#include <sthread.h>
#include <block.h>
#include <logrw.h>

#define BLKSIZE 8
#define NUMBLK 12
#define NUMREGS 3

int main (int argc, const char * argv[]) {
	blocks_t* b;
	printf("block size=%d\n",BLKSIZE);
	printf("number of blocks=%d\n",NUMBLK);
	b=block_new(BLKSIZE,NUMBLK);
	
	printf("blocks_t instance created\n");
	printf("blocks_t block size=%d\n", block_size(b));
	printf("blocks_t number ofblock=%d\n", block_num_blocks(b));
	
	char* block=(char*)malloc(sizeof(char)*BLKSIZE);
	block[0]=(char)1;
	block[1]=(char)2;
printf("block created, dump_block:\n");
dump_block(block);
	
	printf("block_write=%d\n",block_write(b,0,block));
printf("block_dump:\n");
block_dump(b,0);
	char* block1=(char*)malloc(sizeof(char)*BLKSIZE);
	block1[0]=(char)2;
	block1[1]=(char)3;
	printf("block1 created, dump_block 1:\n");
	dump_block(block1);
	printf("block_read=%d\ndump_block 1:\n",block_read(b,0,block1));
	dump_block(block1);
	
	
	
	
	
    return 0;
}

